package day3.demo9;

import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

class MyThread extends Thread {
    private SimpleDateFormat format;
    /* 要转换的日期字符串 */
    String ds;
    public MyThread(SimpleDateFormat format, String ds){
        this.format = format;
        this.ds = ds;
    }
    public void run() {
        Date date = null;
        try {
            date = format.parse(ds);
        } catch (ParseException e) {}
        String newDate = format.format(date);
        if(!newDate.equals(ds)){
            System.out.println(getName() + "日期字符串："+ds + "被转换成：" + newDate);
        }
    }
}